//
//  CLNetWork.h
//  Charles
//
//  Created by Leo on 2017/5/22.
//  Copyright © 2017年 charles. All rights reserved.
//

#import <AFNetworking/AFNetworking.h>
#import "CLNetWorkResult.h"

@interface CLSessionManager : AFHTTPSessionManager

+ (CLSessionManager *)sharedInstance;

@end



typedef NS_ENUM(NSUInteger,CLRequestMethod) {
    CLRequestMethodGET,
    CLRequestMethodPOST
};

typedef void(^RequestSuccessBlock)(NSURLSessionDataTask *task, id responseObject ,CLNetWorkResult *result);
typedef void(^RequestFailureBlock)(NSURLSessionDataTask *task, NSError *error);


@interface CLNetWork : NSObject

@property (strong,nonatomic) NSString *requestUrl;              //请求地址
@property (strong,nonatomic) NSMutableDictionary *baseParams;   //请求的公共参数
@property (strong,nonatomic) NSURLSessionDataTask *dataTask;    //任务
@property (strong,nonatomic) Class responseClass;

+ (NSURLSessionDataTask *)requestDataWithMethod:(CLRequestMethod)method params:(NSDictionary *)params success:(RequestSuccessBlock)success failure:(RequestFailureBlock)failure;

+ (CLSessionManager *)uploadDataWithParams:(NSDictionary *)params suffix:(NSString *)suffix mimeType:(NSString *)mimeType success:(RequestSuccessBlock)success failure:(RequestFailureBlock)failure;

@end
